|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
this is information on a product in full production. march 2014 docid14395 rev 10 1/114 stm8af5xxx stm8af6x69/7x/8x/9x/ax automotive 8-bit mcu, with up to 128 kbytes flash, data eeprom, 10-bit adc, timers, lin, can, usart, spi, i2c, 3 to 5.5 v datasheet - production data features ? core ? max f cpu : 24 mhz ? advanced stm8a core with harvard architecture and 3-stage pipeline ? average 1.6 cycles/instruction resulting in 10 mips at 16 mhz f cpu for industry standard benchmark ? memories ? program memory: 32 to 128 kbytes flash program; data retention 20 years at 55 c ? data memory: up to 2 kbytes true data eeprom; endurance 300 kcycles ? ram: 2 kbytes to 6 kbytes ? clock management ? low-power crystal resonator oscillator with external clock input ? internal, user-trimmable 16 mhz rc and low-power 128 khz rc oscillators ? clock security system with clock monitor ? reset and supply management ? wait/auto-wakeup/halt low-power modes with user definable clock gating ? low consumption power-on and power- down reset ? interrupt management ? nested interrupt controller with 32 vectors ? up to 37 external interrupts on 5 vectors ? timers ? 2 general purpose 16-bit timers with up to 3 capcom channels each (ic, oc, pwm) ? advanced control timer: 16-bit, 4 capcom channels, 3 complementary outputs, dead- time insertion and flexible synchronization ? 8-bit ar basic timer with 8-bit prescaler ? auto-wakeup timer ? window and independent watchdog timers ? i/os ? up to 68 user pins (11 high sink i/os) ? highly robust i/o design, immune against current injection ? communication interfaces ? high speed 1 mbit/s can 2.0b interface ? usart with clock output for synchronous operation - lin master mode ? linuart lin 2.2 compliant, master/slave modes with automatic resynchronization ? spi interface up to 10 mbit/s or f master /2 ?i 2 c interface up to 400 kbit/s ? analog to digital converter (adc) ? 10-bit resolution, 2 lsb tue, 1 lsb linearity and up to 16 multiplexed channels ? operating temperature up to 150 c ? qualification conforms to aec-q100 grade 0 table 1. device summary (1) 1. in the order code, ?f? applies to devices with flash program memory and data eeprom while ?h? refers to devices with flash program memory only. ?f? is replaced by ?p? for devices with fastrom (see tables 2 , 3 , 4 , and 5 , and figure 53 ). reference part number stm8af51xx (with can) (2) 2. not recommended for new design. stm8af5169, stm8af5189, stm8af5198 stm8af52xx (with can) stm8af5268, stm8af5269, stm8af5286, stm8af5288, stm8af5289, stm8af528a, stm8af52a8, stm8af52a9, stm8af52aa stm8af61xx (2) stm8af6178, stm8af6199, stm8af619a stm8af62xx stm8af6269, stm8af6286, stm8af6288, stm8af6289, stm8af628a, stm8af62a6, stm8af62a8, stm8af62a9, stm8af62aa lqfp80 14x14 lqfp48 7x7 lqfp32 7x7 vfqfpn32 5x5 lqfp64 10x10 www.st.com
contents stm8af52/62xx, stm8af51/61xx 2/114 docid14395 rev 10 contents 1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3 product line-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 5 product overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5.1 stm8a central processing unit (cpu) . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5.1.1 architecture and registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5.1.2 addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5.1.3 instruction set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5.2 single wire interface module (swim) and debug module (dm) . . . . . . . . 15 5.2.1 swim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 5.2.2 debug module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 5.3 interrupt controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 5.4 flash program and data eeprom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 5.4.1 architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 5.4.2 write protection (wp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.4.3 protection of user boot code (ubc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.4.4 read-out protection (rop) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.5 clock controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.5.1 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.5.2 16 mhz high-speed internal rc oscillator (hsi) . . . . . . . . . . . . . . . . . . 17 5.5.3 128 khz low-speed internal rc oscillator (lsi) . . . . . . . . . . . . . . . . . . . 18 5.5.4 24 mhz high-speed external crystal oscillator (hse) . . . . . . . . . . . . . . 18 5.5.5 external clock input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5.5.6 clock security system (css) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5.6 low-power operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.7 timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 5.7.1 watchdog timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 5.7.2 auto-wakeup counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 5.7.3 beeper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 docid14395 rev 10 3/114 stm8af52/62xx, stm8af51/61xx contents 4 5.7.4 advanced control and general purpose timers . . . . . . . . . . . . . . . . . . . 20 5.7.5 basic timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 5.8 analog to digital converter (adc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.9 communication interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.9.1 universal synchronous/asynchronous receiver transmitter (usart) . . 22 5.9.2 universal asynchronous receiver/transmitter with lin support (linuart) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 5.9.3 serial peripheral interface (spi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5.9.4 inter integrated circuit (i 2 c) interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5.9.5 controller area network interface (becan) . . . . . . . . . . . . . . . . . . . . . . 26 5.10 input/output specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6 pinouts and pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 6.1 package pinouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 6.2 alternate function remapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 7 memory and register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 7.1 memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 7.2 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 8 interrupt table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 9 option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 10 electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 10.1 parameter conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 10.1.1 minimum and maximum values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 10.1.2 typical values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 10.1.3 typical curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 10.1.4 loading capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 10.1.5 pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 10.2 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 10.3 operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 10.3.1 vcap external capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 10.3.2 supply current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 10.3.3 external clock sources and timing characteristics . . . . . . . . . . . . . . . . . 67 10.3.4 internal clock sources and timing characteristics . . . . . . . . . . . . . . . . . 69 contents stm8af52/62xx, stm8af51/61xx 4/114 docid14395 rev 10 10.3.5 memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 10.3.6 i/o port pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.3.7 reset pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 10.3.8 tim 1, 2, 3, and 4 electrical specifications . . . . . . . . . . . . . . . . . . . . . . . 79 10.3.9 spi interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 10.3.10 i 2 c interface characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 10.3.11 10-bit adc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 10.3.12 emc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 10.4 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 10.4.1 reference document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 10.4.2 selecting the product temperature range . . . . . . . . . . . . . . . . . . . . . . . 90 11 package characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 11.1 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 12 ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 13 stm8 development tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 13.1 emulation and in-circuit debugging tools . . . . . . . . . . . . . . . . . . . . . . . . 102 13.1.1 stice key features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 13.2 software tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 13.2.1 stm8 toolset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 13.2.2 c and assembly toolchains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 13.3 programming tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 14 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 docid14395 rev 10 5/114 stm8af52/62xx, stm8af51/61xx list of tables 6 list of tables table 1. device summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 table 2. stm8af52xx product line-up with can . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 table 3. stm8af62xx product line-up without can . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 table 4. stm8af/h/p51xx product line-up with can . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 table 5. stm8af/h/p61xx product line-up without can . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 table 6. peripheral clock gating bits (clk_pckenr1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 table 7. peripheral clock gating bits (clk_pckenr2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 table 8. advanced control and general purpose timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 table 9. tim4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 table 10. adc naming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 table 11. communication peripheral naming correspondence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 table 12. legend/abbreviation for the pin description table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 table 13. stm8a microcontroller family pin description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 table 14. memory model 128k. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 table 15. i/o port hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 table 16. general hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42 table 17. cpu/swim/debug module/interrupt controller registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 table 18. temporary memory unprotection registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 table 19. stm8a interrupt table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 table 20. option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 table 21. option byte description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 table 22. voltage characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 table 23. current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 table 24. thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 table 25. operating lifetime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 table 26. general operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 table 27. operating conditions at power-up/power-down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 table 28. total current consumption in run, wait and slow mode. general conditions for v dd apply, t a = -40 c to 150 c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 table 29. total current consumption in halt and active-halt modes. general conditions for v dd applied. t a = -40 c to 55 c unless otherwise stated . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 table 30. oscillator current consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 table 31. programming current consumption. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 table 32. typical peripheral current consumption v dd = 5.0 v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 table 33. hse external clock characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67 table 34. hse oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 table 35. hsi oscillator characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 table 36. lsi oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 table 37. flash program memory/data eeprom memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 table 38. flash program memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 table 39. data memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 table 40. i/o static characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 table 41. nrst pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 table 42. tim 1, 2, 3, and 4 electrical specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 table 43. spi characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 table 44. i 2 c characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83 table 45. adc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 table 46. adc accuracy for v dda = 5 v. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 list of tables stm8af52/62xx, stm8af51/61xx 6/114 docid14395 rev 10 table 47. ems data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 table 48. emi data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 table 49. esd absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 table 50. electrical sensitivities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 table 51. thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 table 52. lqfp 80-pin low profile quad flat package mechanical data . . . . . . . . . . . . . . . . . . . . . . . 92 table 53. lqfp 64-pin low profile quad flat package mechanical data . . . . . . . . . . . . . . . . . . . . . . . 93 table 54. lqfp 48-pin low profile quad flat package mechanical data . . . . . . . . . . . . . . . . . . . . . . . 95 table 55. lqfp 32-pin low profile quad flat package mechanical data . . . . . . . . . . . . . . . . . . . . . . . 97 table 56. vfqfpn 32-lead very thin fine pitch quad flat no-lead package mechanical data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 table 57. document revision history. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 docid14395 rev 10 7/114 stm8af52/62xx, stm8af51/61xx list of figures 8 list of figures figure 1. stm8a block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 figure 2. flash memory organization of stm8a products. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 figure 3. lqfp 80-pin pinout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 figure 4. lqfp 64-pin pinout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 figure 5. lqfp 48-pin pinout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 figure 6. stm8af62xx lqfp/vfqfpn 32-pin pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 figure 7. stm8af5286uc vfqfpn32 32-pin pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 figure 8. register and memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 figure 9. pin loading conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 figure 10. pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 figure 11. f cpumax versus v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 figure 12. external capacitor c ext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 figure 13. typ. i dd(run)hse vs. v dd @f cpu = 16 mhz, peripherals = on . . . . . . . . . . . . . . . . . . . . . . 66 figure 14. typ. i dd(run)hse vs. f cpu @ v dd = 5.0 v, peripherals = on . . . . . . . . . . . . . . . . . . . . . . . 66 figure 15. typ. i dd(run)hsi vs. v dd @ f cpu = 16 mhz, peripherals = off . . . . . . . . . . . . . . . . . . . . . . 66 figure 16. typ. i dd(wfi)hse vs. v dd @ f cpu = 16 mhz, peripherals = on . . . . . . . . . . . . . . . . . . . . . . 66 figure 17. typ. i dd(wfi)hse vs. f cpu @ v dd = 5.0 v, peripherals = on . . . . . . . . . . . . . . . . . . . . . . . . 66 figure 18. typ. i dd(wfi)hsi vs. v dd @ f cpu = 16 mhz, peripherals = off . . . . . . . . . . . . . . . . . . . . . . 66 figure 19. hse external clock source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 figure 20. hse oscillator circuit diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 figure 21. typical hsi frequency vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 figure 22. typical lsi frequency vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 figure 23. typical v il and v ih vs v dd @ four temperatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 figure 24. typical pull-up resistance r pu vs v dd @ four temperatures . . . . . . . . . . . . . . . . . . . . . . . 74 figure 25. typical pull-up current i pu vs v dd @ four temperatures (1) . . . . . . . . . . . . . . . . . . . . . . . . . 75 figure 26. typ. v ol @ v dd = 3.3 v (standard ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 figure 27. typ. v ol @ v dd = 5.0 v (standard ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 figure 28. typ. v ol @ v dd = 3.3 v (true open drain ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 figure 29. typ. v ol @ v dd = 5.0 v (true open drain ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 figure 30. typ. v ol @ v dd = 3.3 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 31. typ. v ol @ v dd = 5.0 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 32. typ. v dd - v oh @ v dd = 3.3 v (standard ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 33. typ. v dd - v oh @ v dd = 5.0 v (standard ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 34. typ. v dd - v oh @ v dd = 3.3 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 35. typ. v dd - v oh @ v dd = 5.0 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 36. typical nrst v il and v ih vs v dd @ four temperatures . . . . . . . . . . . . . . . . . . . . . . . . . . 77 figure 37. typical nrst pull-up resistance r pu vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 figure 38. typical nrst pull-up current i pu vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 figure 39. recommended reset pin protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 9 figure 40. spi timing diagram in slave mode and with cpha = 0. . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 41. spi timing diagram in slave mode and with cpha = 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 42. spi timing diagram - master mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 figure 43. typical application with adc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 figure 44. adc accuracy characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 figure 45. lqfp 80-pin low profile quad flat package (14 x 14) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 figure 46. lqfp 64-pin low profile quad flat package (10 x 10) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 figure 47. lqfp 64-pin recommended footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 figure 48. lqfp 48-pin low profile quad flat package (7 x 7) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 list of figures stm8af52/62xx, stm8af51/61xx 8/114 docid14395 rev 10 figure 49. lqfp 48-pin recommended footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 figure 50. lqfp 32-pin low profile quad flat package (7 x 7) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 figure 51. lqfp 32-pin recommended footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 figure 52. vfqfpn 32-lead very thin fine pitch quad flat no-lead package (5 x 5). . . . . . . . . . . . . . . 99 figure 53. ordering information scheme (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 docid14395 rev 10 9/114 stm8af52/62xx, stm8af51/61xx introduction 113 1 introduction this datasheet refers to the stm8af52xx, stm8af62xx, stm8af51xx, and stm8af61xx products with 32 to 128 kbytes of program memory. in the order code, the letter ?f? refers to product versions with flash and data eeprom, ?h? to product versions with flash only, and ?p? to product versions with fastrom. the identifiers ?f?, ?h?, and ?p? do not coexist in a given order code. the datasheet contains the description of family features, pinout, electrical characteristics, mechanical data and ordering information. ? for complete information on the stm8a microcontroller memory, registers and peripherals, please refer to stm8s and stm8a microcontroller families reference manual (rm0016). ? for information on programming, erasing and protection of the internal flash memory please refer to the stm8s and stm8a flash programming manual (pm0051). ? for information on the debug and swim (single wire interface module) refer to the stm8 swim communication protocol and debug module user manual (um0470). ? for information on the stm8 core, please refer to the stm8 cpu programming manual (pm0044). description stm8af52/62xx, stm8af51/61xx 10/114 docid14395 rev 10 2 description the stm8af52xx, stm8af62xx, stm8af51xx, and stm8af61xx automotive 8-bit microcontrollers described in this datasheet offer from 32 kbytes to 128 kbytes of non volatile memory and integrated true data eeprom. they are referred to as high density stm8a devices in the stm8s and stm8a microcontroller families reference manual (rm0016). the stm8af51xx and stm8af52xx series feature a can interface. all devices of the stm8a product line provide the following benefits: reduced system cost, performance and robustness, short development cycles, and product longevity. the system cost is reduced thanks to an integrated true data eeprom for up to 300 k write/erase cycles and a high system integration level with internal clock oscillators, wtachdog, and brown-out reset. device performance is ensured by 20 mips at 24 mhz cpu clock frequency and enhanced characteristics which include robust i/o, independent watchdogs (with a separate clock source), and a clock security system. short development cycles are guaranteed due to application scalability across a common family product architecture with compatible pinout, memory map, and modular peripherals. full documentation is offered with a wide choice of development tools. product longevity is ensured in the stm8a family thanks to their advanced core which is made in a state-of-the art technology for automotive applications with 3.3 v to 5.5 v operating supply. all stm8a and st7 microcontrollers are supported by the same tools including stvd/stvp development environment, the stice emulator and a low-cost, third party in- circuit debugging tool. docid14395 rev 10 11/114 stm8af52/62xx, stm8af51/61xx product line-up 113 3 product line-up .. table 2. stm8af52xx product line-up with can order code package high density flash program memory (bytes) ram (bytes) data eeprom (bytes) 10-bit a/d chan. timers (ic/oc/pwm) serial interfaces i/0 wakeup pins stm8af/p52aa lqfp80 (14x14) 128 k 6 k 2 k 16 1x8-bit: tim4 3x16-bit: tim1, tim2, tim3 (9/9/9) can, lin(uart), spi, usart, i2c 68/37 stm8af/p528a 64 k stm8af/p52a9 lqfp64 (10x10) 128 k 52/36 stm8af/p5289 64 k stm8af/p5269 32 k 1 k stm8af/p52a8 lqfp48 (7x7) 128 k 2 k 10 38/35 stm8af/p5288 64 k stm8af/p5268 32 k 1k stm8af/p5286 vfqfpn32 (5x5) 64 k 2 k6 1x8-bit: tim4 3x16-bit: tim1, tim2, tim3 (8/8/8) can, lin(uart), i2c 25/24 table 3. stm8af62xx product line-up without can order code package high density flash program memory (bytes) ram (bytes) data eeprom (bytes) 10-bit a/d chan. timers (ic/oc/pwm) serial interfaces i/0 wakeup pins stm8af/p62aa lqfp80 (14x14) 128 k 6 k 2 k 16 1x8-bit: tim4 3x16-bit: tim1, tim2, tim3 (9/9/9) lin(uart), spi, usart, i2c 68/37 stm8af/p628a 64 k stm8af/p62a9 lqfp64 (10x10) 128 k 52/36 stm8af/p6289 64 k 2 k stm8af/p6269 32 k 1 k stm8af/p62a8 lqfp48 (7x7) 128 k 2 k 10 38/35 stm8af/p6288 64 k stm8af/p6286 lqfp32 (7x7) 7 1x8-bit: tim4 3x16-bit: tim1, tim2, tim3 (8/8/8) lin(uart), spi, i2c 25/23 stm8af/p62a6 vfqfpn32 (5x5) 128 k product line-up stm8af52/62xx, stm8af51/61xx 12/114 docid14395 rev 10 . 2 table 4. stm8af/h/p51xx product line-up with can (1) 1. not recommended for new designs. order code package high density flash program memory (bytes) ram (bytes) data eeprom (bytes) 10-bit a/d chan. timers (ic/oc/pwm) serial interfaces i/0 wakeup pins stm8af/h/p5189 lqfp64 (10x10) 64 k 4 k 1.5 k 16 1x8-bit: tim4 3x16-bit: tim1, tim2, tim3 (9/9/9) can, lin(uart) , spi, usart, i2c 52/36 stm8af/h/p5169 32 k 2 k 1 k stm8af/h/p5198 lqfp48 (7x7) 96 k 6 k 2 k 10 38/35 table 5. stm8af/h/p61xx product line-up without can (1) 1. not recommended for new designs. order code package high density flash program memory (bytes) ram (bytes) data eeprom (bytes) 10-bit a/d chan. timers (ic/oc/pwm) serial interfaces i/0 wakeup pins stm8af/h/p619a lqfp80 (14x14) 96 k 6 k 2 k 16 1x8-bit: tim4 3x16-bit: tim1, tim2, tim3 (9/9/9) lin(uart) , spi, usart, i2c 68/37 stm8af/h/p6199 lqfp64 (10x10) 52/36 stm8af/h/p6178 lqfp48 (7x7) 48 k 3 k 1.5 k 10 38/35 docid14395 rev 10 13/114 stm8af52/62xx, stm8af51/61xx block diagram 113 4 block diagram figure 1. stm8a block diagram 1. legend: adc: analog-to-digital converter becan: controller area network bor: brownout reset i2c: inter-integrated circuit multimaster interface iwdg: independent window watchdog linuart: local interconnect network universal asynchronous receiver transmitter por: power on reset spi: serial peripheral interface swim: single wire interface module usart: universal synchronous asynchronous receiver transmitter window wdg: window watchdog xtal 1-24 mhz rc int. 16 mhz rc int. 128 khz stm8a core debug/swim i 2 c spi usart linuart 16-bit general purpose awu timer reset block reset clock controller detector clock to peripherals and core 10 mbit/s lin master up to window wdg iwdg up to 128 kbyte up to 2 kbytes up to 6 kbytes boot rom 10-bit adc becan 9 capcom reset 400 kbit/s 1 mbit/s master/slave single wire automatic debug interf. spi emul. channels high density program flash 16-bit advanced control timer (tim1) (tim2, tim3) 8-bit ar timer (tim4) data eeprom ram up to address and data bus 16 channels resynchronization por bor product overview stm8af52/62xx, stm8af51/61xx 14/114 docid14395 rev 10 5 product overview this section is intended to describe the family features that are actually implemented in the products covered by this datasheet. for more detailed information on each feature please refer to the stm8s and stm8a microcontroller families reference manual (rm0016). 5.1 stm8a central processing unit (cpu) the 8-bit stm8a core is a modern cisc core and has been designed for code efficiency and performance. it contains 21 internal registers (six directly addressable in each execution context), 20 addressing modes including indexed indirect and relative addressing and 80 instructions. 5.1.1 architecture and registers ? harvard architecture ? 3-stage pipeline ? 32-bit wide program memory bus with single cycle fetching for most instructions ? x and y 16-bit index registers, enabling indexed addressing modes with or without offset and read-modify-write type data manipulations ? 8-bit accumulator ? 24-bit program counter with 16-mbyte linear memory space ? 16-bit stack pointer with access to a 64 kbyte stack ? 8-bit condition code register with seven condition flags for the result of the last instruction. 5.1.2 addressing ? 20 addressing modes ? indexed indirect addressing mode for look-up tables located anywhere in the address space ? stack pointer relative addressing mode for efficient implementation of local variables and parameter passing 5.1.3 instruction set ? 80 instructions with 2-byte average instruction size ? standard data movement and logic/arithmetic functions ? 8-bit by 8-bit multiplication ? 16-bit by 8-bit and 16-bit by 16-bit division ? bit manipulation ? data transfer between stack and accumulator (push/pop) with direct stack access ? data transfer using the x and y registers or direct memory-to-memory transfers docid14395 rev 10 15/114 stm8af52/62xx, stm8af51/61xx product overview 113 5.2 single wire interface module (swim) and debug module (dm) 5.2.1 swim the single wire interface module, swim, together with an integrated debug module, permits non-intrusive, real-time in-circuit debugging and fast memory programming. the interface can be activated in all device operation modes and can be connected to a running device (hot plugging).the maximum data transmission speed is 145 bytes/ms. 5.2.2 debug module the non-intrusive debugging module features a performance close to a full-flavored emulator. besides memory and peripheral operation, cpu operation can also be monitored in real-time by means of shadow registers. ? r/w of ram and peripheral registers in real-time ? r/w for all resources when the application is stopped ? breakpoints on all program-memory instructions (software breakpoints), except the interrupt vector table ? two advanced breakpoints and 23 predefined breakpoint configurations 5.3 interrupt controller ? nested interrupts with three software priority levels ? 24 interrupt vectors with hardware priority ? five vectors for external interrupts (up to 37 depending on the package) ? trap and reset interrupts 5.4 flash program and data eeprom ? 32 kbytes to 128 kbytes of high density single voltage flash program memory ? up to 2 kbytes true (not emulated) data eeprom ? read while write: writing in the data memory is possible while executing code in the flash program memory. the whole flash program memory and data eeprom are factory programmed with 0x00. 5.4.1 architecture ? the memory is organized in blocks of 128 bytes each ? read granularity: 1 word = 4 bytes ? write/erase granularity: 1 word (4 bytes) or 1 block (128 bytes) in parallel ? writing, erasing, word and block management is handled automatically by the memory interface. product overview stm8af52/62xx, stm8af51/61xx 16/114 docid14395 rev 10 5.4.2 write protection (wp) write protection in application mode is intended to avoid unintentional overwriting of the memory. the write protection can be removed temporarily by executing a specific sequence in the user software. 5.4.3 protection of user boot code (ubc) if the user chooses to update the flash program memory using a specific boot code to perform in application programming (iap), this boot code needs to be protected against unwanted modification. in the stm8a a memory area of up to 128 kbytes can be protected from overwriting at user option level. other than the standard write protection, the ubc protection can exclusively be modified via the debug interface, the user software cannot modify the ubc protection status. the ubc memory area contains the reset and interrupt vectors and its size can be adjusted in increments of 512 bytes by programming the ubc and nubc option bytes (see section 9: option bytes on page 53 ). figure 2. flash memory organization of stm8a products 5.4.4 read-out protection (rop) the stm8a provides a read-out protection of the code and data memory which can be activated by an option byte setting (see the rop option byte in section 10). the read-out protection prevents reading and writing flash program memory, data memory and option bytes via the debug module and swim interface. this protection is active in all device operation modes. any attempt to remove the protection by overwriting the rop option byte triggers a global erase of the program and data memory. the rop circuit may provide a temporary access for debugging or failure analysis. the temporary read access is protected by a user defined, 8-byte keyword stored in the option byte area. this keyword must be entered via the swim interface to temporarily unlock the device. programmable area from 1 kbyte data ubc area program memory area data memory area (first two pages) up to program memory eeprom remains write protected during iap memory write access possible for iap option bytes end - maximum 128 kbytes flash program memory docid14395 rev 10 17/114 stm8af52/62xx, stm8af51/61xx product overview 113 if desired, the temporary unlock mechanism can be permanently disabled by the user through opt6/nopt6 option bytes. 5.5 clock controller the clock controller distributes the system clock coming from different oscillators to the core and the peripherals. it also manages clock gating for low-power modes and ensures clock robustness. 5.5.1 features ? clock sources ?16 mhz high-speed internal rc oscillator (hsi) ? 128 khz low-speed internal rc (lsi) ? 1-24 mhz high-speed external crystal (hse) ? up to 24 mhz high-speed user-external clock (hse user-ext) ? reset : after reset the microcontroller restarts by default with an internal 2-mhz clock (16 mhz/8). the clock source and speed can be changed by the application program as soon as the code execution starts. ? safe clock switching : clock sources can be changed safely on the fly in run mode through a configuration register. the clock signal is not switched until the new clock source is ready. the design guarantees glitch-free switching. ? clock management : to reduce power consumption, the clock controller can stop the clock to the core, individual peripherals or memory. ? wakeup : in case the device wakes up from low-power modes, the internal rc oscillator (16 mhz/8) is used for quick startup. after a stabilization time, the device switches to the clock source that was selected before halt mode was entered. ? clock security system (css) : the css permits monitoring of external clock sources and automatic switching to the internal rc (16 mhz/8) in case of a clock failure. ? configurable main clock output (cco) : this feature permits to outputs a clock signal for use by the application. 5.5.2 16 mhz high-speed internal rc oscillator (hsi) ? default clock after reset 2 mhz (16 mhz/8) ? fast wakeup time user trimming the register clk_hsitrimr with two trimming bits plus one additional bit for the sign permits frequency tuning by the application program. the adjustment range covers all possible frequency variations versus supply voltage and temperature. this trimming does not change the initial production setting. product overview stm8af52/62xx, stm8af51/61xx 18/114 docid14395 rev 10 5.5.3 128 khz low-speed internal rc oscillator (lsi) the frequency of this clock is 128 khz and it is independent from the main clock. it drives the independent watchdog or the awu wakeup timer. in systems which do not need independent clock sources for the watchdog counters, the 128 khz signal can be used as the system clock. this configuration has to be enabled by setting an option byte (opt3/opt3n, bit lsi_en). 5.5.4 24 mhz high-speed external crystal oscillator (hse) the external high-speed crystal oscillator can be selected to deliver the main clock in normal run mode. it operates with quartz crystals and ceramic resonators. ? frequency range: 1 mhz to 24 mhz ? crystal oscillation mode: preferred fundamental ? i/os: standard i/o pins multiplexed with oscin, oscout 5.5.5 external clock input an external clock signal can be applied to the oscin input pin of the crystal oscillator. the frequency range is 0 to 24 mhz. 5.5.6 clock security system (css) the clock security system protects against a system stall in case of an external crystal clock failure. in case of a clock failure an interrupt is generated and the high-speed internal clock (hsi) is automatically selected with a frequency of 2 mhz (16 mhz/8). table 6. peripheral clock gating bits (clk_pckenr1) control bit peripheral pcken17 tim1 pcken16 tim3 pcken15 tim2 pcken14 tim4 pcken13 linuart pcken12 usart pcken11 spi pcken10 i 2 c docid14395 rev 10 19/114 stm8af52/62xx, stm8af51/61xx product overview 113 5.6 low-power operating modes for efficient power management, the application can be put in one of four different low- power modes. you can configure each mode to obtain the best compromise between lowest power consumption, fastest start-up time and available wakeup sources. ? wait mode in this mode, the cpu is stopped but peripherals are kept running. the wakeup is performed by an internal or external interrupt or reset. ? active-halt mode with regulator on in this mode, the cpu and peripheral clocks are stopped. an internal wakeup is generated at programmable intervals by the auto wake up unit (awu). the main voltage regulator is kept powered on, so current consumption is higher than in active- halt mode with regulator off, but the wakeup time is faster. wakeup is triggered by the internal awu interrupt, external interrupt or reset. ? active-halt mode with regulator off this mode is the same as active-halt with regulator on, except that the main voltage regulator is powered off, so the wake up time is slower. ? halt mode cpu and peripheral clocks are stopped, the main voltage regulator is powered off. wakeup is triggered by external event or reset. in all modes the cpu and peripherals remain permanently powered on, the system clock is applied only to selected modules. the ram content is preserved and the brown-out reset circuit remains activated. table 7. peripheral clock gating bits (clk_pckenr2) control bit peripheral pcken27 can pcken26 reserved pcken25 reserved pcken24 reserved pcken23 adc pcken22 awu pcken21 reserved pcken20 reserved product overview stm8af52/62xx, stm8af51/61xx 20/114 docid14395 rev 10 5.7 timers 5.7.1 watchdog timers the watchdog system is based on two independent timers providing maximum security to the applications. the watchdog timer activity is controlled by the application program or option bytes. once the watchdog is activated, it cannot be disabled by the user program without going through reset. window watchdog timer the window watchdog is used to detect the occurrence of a software fault, usually generated by external interferences or by unexpected logical conditions, which cause the application program to abandon its normal sequence. the window function can be used to trim the watchdog behavior to match the application timing perfectly. the application software must refresh the counter before time-out and during a limited time window. if the counter is refreshed outside this time window, a reset is issued. independent watchdog timer the independent watchdog peripheral can be used to resolve malfunctions due to hardware or software failures. it is clocked by the 128 khz lsi internal rc clock source, and thus stays active even in case of a cpu clock failure. if the hardware watchdog feature is enabled through the device option bits, the watchdog is automatically enabled at power-on, and generates a reset unless the key register is written by software before the counter reaches the end of count. 5.7.2 auto-wakeup counter this counter is used to cyclically wakeup the device in active-halt mode. it can be clocked by the internal 128 khz internal low-frequency rc oscillator or external clock. lsi clock can be internally connected to tim3 input capture channel 1 for calibration. 5.7.3 beeper this function generates a rectangular signal in the range of 1, 2 or 4 khz which can be output on a pin. this is useful when audible sounds without interference need to be generated for use in the application. 5.7.4 advanced control and general purpose timers stm8a devices described in this datasheet, contain up to three 16-bit advanced control and general purpose timers providing nine capcom channels in total. a capcom channel can be used either as input compare, output compare or pwm channel. these timers are named tim1, tim2 and tim3. docid14395 rev 10 21/114 stm8af52/62xx, stm8af51/61xx product overview 113 tim1 - advanced control timer this is a high-end timer designed for a wide range of control applications. with its complementary outputs, dead-time control and center-aligned pwm capability, the field of applications is extended to motor control, lighting and bridge driver. ? 16-bit up, down and up/down ar (auto-reload) counter with 16-bit fractional prescaler. ? four independent capcom channels configurable as input capture, output compare, pwm generation (edge and center aligned mode) and single pulse mode output ? trigger module which allows the interaction of tim1 with other on-chip peripherals. in the present implementation it is possible to trigger the adc upon a timer event. ? external trigger to change the timer behavior depending on external signals ? break input to force the timer outputs into a defined state ? three complementary outputs with adjustable dead time ? interrupt sources: 4 x input capture/output compare, 1 x overflow/update, 1 x break tim2, tim3 - 16-bit general purpose timers ? 16-bit auto-reload up-counter ? 15-bit prescaler adjustable to fixed power of two ratios 1?32768 ? timers with three or two individually configurable capcom channels ? interrupt sources: 2 or 3 x input capture/output compare, 1 x overflow/update 5.7.5 basic timer the typical usage of this timer (tim4) is the generation of a clock tick. ? 8-bit auto-reload, adjustable prescaler ratio to any power of two from 1 to 128 ? clock source: master clock ? interrupt source: 1 x overflow/update table 8. advanced control and general purpose timers timer counter width counter type prescaler factor channels inverted outputs repetition counter trigger unit external trigger break input tim1 16-bit up/down 1 to 65536 4 3 yes yes yes yes tim2 16-bit up 2 n n = 0 to 15 3 none no no no no tim3 16-bit up 2 n n = 0 to 15 2 none no no no no table 9. tim4 timer counter width counter type prescaler factor channels inverted outputs repetition counter trigger unit external trigger break input tim4 8-bit up 2 n n = 0 to 7 0 none no no no no product overview stm8af52/62xx, stm8af51/61xx 22/114 docid14395 rev 10 5.8 analog to digital converter (adc) the stm8a products described in this datasheet contain a 10-bit successive approximation adc with up to 16 multiplexed input channels, depending on the package. the adc name differs between the datasheet and the stm8a/s reference manual (see table 10 ). adc features ? 10-bit resolution ? single and continuous conversion modes ? programmable prescaler: f master divided by 2 to 18 ? conversion trigger on timer events, and external events ? interrupt generation at end of conversion ? selectable alignment of 10-bit data in 2 x 8 bit result registers ? shadow registers for data consistency ? adc input range: v ssa v in v dda ? schmitt-trigger on analog inputs can be disabled to reduce power consumption 5.9 communication interfaces the following sections give a brief overview of the communication peripheral. some peripheral names differ between the datasheet and the stm8a/s reference manual (see table 11 ). 5.9.1 universal synchronous/asynchronous receiver transmitter (usart) the devices covered by this datasheet contain one usart interface. the usart can operate in standard sci mode (serial communication interface, asynchronous) or in spi emulation mode. it is equipped with a 16 bit fractional prescaler. it features lin master support. table 10. adc naming peripheral name in datasheet peripheral name in reference manual (rm0016) adc adc2 table 11. communication peripheral naming correspondence peripheral name in datasheet peripheral name in reference manual (rm0016) usart uart1 linuart uart3 docid14395 rev 10 23/114 stm8af52/62xx, stm8af51/61xx product overview 113 detailed feature list: ? full duplex, asynchronous communications ? nrz standard format (mark/space) ? high-precision baud rate generator system ? common programmable transmit and receive baud rates up to f master /16 ? programmable data word length (8 or 9 bits) ? configurable stop bits: support for 1 or 2 stop bits ? lin master mode: ? lin break and delimiter generation ? lin break and delimiter detection with separate flag and interrupt source for readback checking. ? transmitter clock output for synchronous communication ? separate enable bits for transmitter and receiver ? transfer detection flags: ? receive buffer full ? transmit buffer empty ? end of transmission flags ? parity control: ? transmits parity bit ? checks parity of received data byte ? four error detection flags: ? overrun error ? noise error ? frame error ? parity error ? six interrupt sources with flags: ? transmit data register empty ? transmission complete ? receive data register full ? idle line received ? parity error ? lin break and delimiter detection ? two interrupt vectors: ? transmitter interrupt ? receiver interrupt ? reduced power consumption mode ? wakeup from mute mode (by idle line detection or address mark detection) ? two receiver wakeup modes: ? address bit (msb) ? idle line product overview stm8af52/62xx, stm8af51/61xx 24/114 docid14395 rev 10 5.9.2 universal asynchronous receiver/transmitter with lin support (linuart) the devices covered by this datasheet contain one linuart interface. the interface is available on all the supported packages. the linuart is an asynchronous serial communication interface which supports extensive lin functions tailored for lin slave applications. in lin mode it is compliant to the lin standards rev 1.2 to rev 2.2. detailed feature list: lin mode master mode ? lin break and delimiter generation ? lin break and delimiter detection with separate flag and interrupt source for read back checking. slave mode ? autonomous header handling ? one single interrupt per valid header ? mute mode to filter responses ? identifier parity error checking ? lin automatic resynchronization, allowing operation with internal rc oscillator (hsi) clock source ? break detection at any time, even during a byte reception ? header errors detection: ? delimiter too short ? synch field error ? deviation error (if automatic resynchronization is enabled) ? framing error in synch field or identifier field ? header time-out uart mode ? full duplex, asynchronous communications - nrz standard format (mark/space) ? high-precision baud rate generator ? a common programmable transmit and receive baud rates up to f master /16 ? programmable data word length (8 or 9 bits) ? 1 or 2 stop bits ? parity control ? separate enable bits for transmitter and receiver ? error detection flags ? reduced power consumption mode ? multi-processor communication - enter mute mode if address match does not occur ? wakeup from mute mode (by idle line detection or address mark detection) ? two receiver wakeup modes: ? address bit (msb) ? idle line docid14395 rev 10 25/114 stm8af52/62xx, stm8af51/61xx product overview 113 5.9.3 serial peripheral interface (spi) the devices covered by this datasheet contain one spi. the spi is available on all the supported packages. ? maximum speed: 10 mbit/s or f master /2 for master, 8 mbit/s or f master /2 for slave ? full duplex synchronous transfers ? simplex synchronous transfers on two lines with a possible bidirectional data line ? master or slave operation - selectable by hardware or software ? crc calculation ? 1 byte tx and rx buffer ? slave mode/master mode management by hardware or software for both master and slave ? programmable clock polarity and phase ? programmable data order with msb-first or lsb-first shifting ? dedicated transmission and reception flags with interrupt capability ? spi bus busy status flag ? hardware crc feature for reliable communication: ? crc value can be transmitted as last byte in tx mode ? crc error checking for last received byte 5.9.4 inter integrated circuit (i 2 c) interface the devices covered by this datasheet contain one i 2 c interface. the interface is available on all the supported packages. ? i 2 c master features: ? clock generation ? start and stop generation ? i 2 c slave features: ? programmable i 2 c address detection ? stop bit detection ? generation and detection of 7-bit/10-bit addressing and general call ? supports different communication speeds: ? standard speed (up to 100 khz), ? fast speed (up to 400 khz) ? status flags: ? transmitter/receiver mode flag ? end-of-byte transmission flag ?i 2 c busy flag ? error flags: ? arbitration lost condition for master mode ? acknowledgement failure after address/data transmission ? detection of misplaced start or stop condition ? overrun/underrun if clock stretching is disabled product overview stm8af52/62xx, stm8af51/61xx 26/114 docid14395 rev 10 ? interrupt: ? successful address/data communication ? error condition ? wakeup from halt ? wakeup from halt on address detection in slave mode 5.9.5 controller area network interface (becan) the becan controller (basic enhanced can), interfaces the can network and supports the can protocol version 2.0a and b. it is equipped with a receive fifo and a very versatile filter bank. together with a filter match index, this allows a very efficient message handling in today?s car network architectures. the cpu is significantly unloaded. the maximum transmission speed is 1 mbit/s. transmission ? three transmit mailboxes ? configurable transmit priority by identifier or order request reception ? 11- and 29-bit id ? 1 receive fifo (3 messages deep) ? software-efficient mailbox mapping at a unique address space ? fmi (filter match index) stored with message for quick message association ? configurable fifo overrun ? time stamp on sof reception ? 6 filter banks, 2 x 32 bytes (scalable to 4 x 16-bit) each, enabling various masking configurations, such as 12 filters for 29-bit id or 48 filters for 11-bit id. ? filtering modes (mixable): ? mask mode permitting id range filtering ? id list mode interrupt management ? maskable interrupt ? software-efficient mailbox mapping at a unique address space docid14395 rev 10 27/114 stm8af52/62xx, stm8af51/61xx product overview 113 5.10 input/output specifications the product features four i/o types: ? standard i/o 2 mhz ? fast i/o up to 10 mhz ? high sink 8 ma, 2 mhz ? true open drain (i 2 c interface) to decrease emi (electromagnetic interference), high sink i/os have a limited maximum slew rate. the rise and fall times are similar to those of standard i/os. the analog inputs are equipped with a low leakage analog switch. additionally, the schmitt- trigger input stage on the analog i/os can be disabled in order to reduce the device standby consumption. stm8a i/os are designed to withstand current injection. for a negative injection current of 4 ma, the resulting leakage current in the adjacent input does not exceed 1 a. thanks to this feature, external protection diodes against current injection are no longer required. caution: in stm8af5286uc device, the following i/o ports are not automatically configured by hardware: pa3, pa4, pa5, pa6, pf4, pb6, pb7, pe0, pe1, pe2, pe3, pe6, pe7. as a consequence, they must be put into one of the following configurations by software: - configured as input with internal pull-up/down resistor, - configured as output push-pull low. pinouts and pin description stm8af52/62xx, stm8af51/61xx 28/114 docid14395 rev 10 6 pinouts and pin description 6.1 package pinouts figure 3. lqfp 80-pin pinout 1. the can interface is only available on the stm8af/h/p51xx and stm8af52xx product lines. 2. (hs) stands for high sink capability. pd4 (hs)/tim2_ch1/beep 2 1 3 4 5 6 7 8 10 9 12 14 16 18 20 11 15 13 17 19 25 26 28 27 30 32 34 36 38 29 33 31 35 37 39 57 58 56 55 54 53 52 51 49 50 47 45 43 41 48 44 46 42 60 59 61 62 63 64 66 68 65 67 69 70 71 72 74 73 75 76 77 78 79 80 pi4 pi3 pi2 pi1 pc4 (hs)/tim1_ch4 pc3 (hs)/tim1_ch3 pc2 (hs)/tim1_ch2 pc1 (hs)/tim1_ch1 pg6 pg5 pi5 pi0 pg4 pg3 pg2 pc7/spi_miso v ssio_2 v ddio_1 tim2_ch3/pa3 usart_rx/pa4 usart_tx/pa5 ain12/pf4 v ssio_1 v ss vcap v dd usart_ck/pa6 (hs) ph0 ( hs) ph1 ph2 ph3 ain15/pf7 ain14/pf6 ain13/pf5 nrst oscin/pa1 oscout/pa2 ain5/pb5 ain4/pb4 ain1/pb1 ain0/pb0 ain8/pe7 v ref- ain10/pf0 ain7/pb7 ain6/pb6 tim1_etr/ph4 tim1_ch3n/ph5 tim1_ch2n/ph6 40 ain9/pe6 21 22 24 23 ain11/pf3 v ref+ v dda v ssa pd0 (hs)/tim3_ch2 pe2/i 2c_sda pe3/tim1_bkin pe4 pg7 pd7/tli pd6/linuart_rx pd5/linuart_tx pi7 pi6 pd2 (hs)/tim3_ch1 pd1 (hs)/swim pc5/spi_sck pc6/spi_mosi pg0/can_tx (1) pg1/can_rx (1) pe0/clk_cco pd3 (hs)/tim2_ch2 ain3/pb3 ain2/pb2 pc0/adc_etr pe5/spi_nss tim1_ch1n/ph7 v ddio_2 pe1/i2c_scl docid14395 rev 10 29/114 stm8af52/62xx, stm8af51/61xx pinouts and pin description 113 figure 4. lqfp 64-pin pinout 1. the can interface is only available on the stm8af/h/p51xx and stm8af52xx product lines. 2. hs stands for high sink capability. v ref- ain10/pf0 ain7/pb7 ain6/pb6 ain5/pb5 ain4/pb4 tim1_etr/ain3/pb3 tim1_ch3n/ain2/pb2 tim1_ch2n/ain1/pb1 tim1_ch1n/ain0/pb0 ain8/pe7 ain9/pe6 ain11/pf3 v ref+ v dda v ssa 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 17 18 19 20 21 22 23 24 29 30 31 32 25 26 27 28 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 v ss vcap v dd v ddio_1 tim2_ch3/pa3 usart_rx/pa4 usart_tx/pa5 usart_ck/pa6 ain15/pf7 ain14/pf6 ain13/pf5 ain12/pf4 nrst oscin/pa1 oscout/pa2 v ssio_1 pg1/can_rx (1) pg0/can_tx (1) pc7/spi_miso pc6/spi_mosi v ddio_2 v ssio_2 pc5/spi_sck pc4 (hs)/tim1_ch4 pc3 (hs)/tim1_ch3 pc2 (hs)/tim1_ch2 pc1 (hs)/tim1_ch1 pe5/spi_nss pi0 pg4 pg3 pg2 pd3 (hs)/tim2_ch2/adc_etr pd2 (hs)/tim3_ch1 pd1 (hs)/swim pd0 (hs)/tim3_ch2 pe0/clk_cco pe1/i2c_scl pe2/i2c_sda pe3/tim1_bkin pe4 pg7 pg6 pg5 pd7/tli pd6/linuart_rx pd5/linuart_tx pd4 (hs)/tim2_ch1/ beep pinouts and pin description stm8af52/62xx, stm8af51/61xx 30/114 docid14395 rev 10 figure 5. lqfp 48-pin pinout 1. the can interface is only available on the stm8af/h/p51xx and stm8af52xx product lines. 2. hs stands for high sink capability. 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 48 47 46 45 usart_ck/pa6 ain8/pe7 pc1 (hs)/tim1_ch1 pe5/spi_nss pg1/can_rx ain9/pe6 pd3 (hs)/tim2_ch2/adc_etr pd2 (hs)/tim3_ch1 pe0/clk_cco pe1/i 2 c_scl pe2/i 2 c_sda pe3/tim1_bkin pd7/tli pd6/linuart_rx pd5/linuart_tx pd4 (hs)/tim2_ch1/beep pd1 (hs)/swim pd0 (hs)/tim3_ch2 v ssio_2 pc5/spi_sck pc4 (hs)/tim1_ch4 pc3 (hs)/tim1_ch3 pc2 (hs)/tim1_ch2 pg0/can_tx pc7/spi_miso pc6/spi_mosi v ddio_2 ain7/pb7 ain6/pb6 ain5/pb5 ain4/pb4 tim1_etr/ain3/pb3 tim1_ch3n/ain2/pb2 tim1_ch2n/ain1/pb1 tim1_ch1n/ain0/pb0 v dda v ssa v ss vcap v dd v ddio_1 tim2_ch3/pa3 usart_rx/pa4 usart_tx/pa5 nrst oscin/pa1 oscout/pa2 v ssio_1 docid14395 rev 10 31/114 stm8af52/62xx, stm8af51/61xx pinouts and pin description 113 figure 6. stm8af62xx lqfp/vfqfpn 32-pin pinout 1. hs stands for high sink capability. i2c_scl/ain4/pb4 tim1_etr/ain3/pb3 tim1_ch3n/ain2/pb2 tim1_ch2n/ain1/pb1 tim1_ch1n/ain0/pb0 v dda v ssa i2c_sda/ain5/pb5 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 9101112 13 14 15 16 1 2 3 4 5 6 7 8 vcap v dd v ddio ain12/pf4 nrst oscin/pa1 oscout/pa2 v ss pc3 (hs)/tim1_ch3 pc2 (hs)/tim1_ch2 pc1 (hs)/tim1_ch1 pe5/spi_nss pc7/spi_miso pc6/spi_mosi pc5/spi_sck pc4 (hs)/tim1_ch4 pd3 (hs)/tim2_ch2/adc_etr pd2 (hs)/tim3_ch1/tim2_ch3 pd1 (hs)/swim pd0 (hs)/tim3_ch2/clk_cco/tim1_brk pd7/tli pd6/linuart_rx pd5/linuart_tx pd4 (hs)/tim2_ch1/beep pinouts and pin description stm8af52/62xx, stm8af51/61xx 32/114 docid14395 rev 10 figure 7. stm8af5286uc vfqfpn32 32-pin pinout 1. the following i/o ports are not automatically configured by hardware: pa3, pa4, pa5, pa6, pf4, pb6, pb7, pe0, pe1, pe2, pe3, pe6, pe7. as a consequence, they must be put into one of the following configurations by software: - configured as input with internal pull-up/down resistor, - configured as output push-pull low. 2. hs stands for high sink capability. 3 ' 7 / , 1 % - * / 6 " 3 5 @ 3 9 ' / , 1 8 $ 5 7 b 7 ; 3 ' + 6 7 , 0 b & |